﻿using Microsoft.AspNetCore.Mvc.Filters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FurStudy.Web.Entry.Filter
{
    public class SampleAsyncActionFilter : IAsyncActionFilter
    {
        /// <summary>
        /// 详细用法可参见 ASP.NET Core 5.0 - 筛选器(https://docs.microsoft.com/zh-cn/aspnet/core/mvc/controllers/filters?view=aspnetcore-5.0)
        /// </summary>
        /// <param name="context"></param>
        /// <param name="next"></param>
        /// <returns></returns>
        public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            // 拦截之前
            var resultContext = await next();

            // 拦截之后

            // 异常拦截
            if (resultContext.Exception != null)
            {

            }
        }
    }
}
